// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const toNumber = (data: any) => {
  const type = typeof data;
  if (type !== "number" && type !== "string") return NaN;
  return data === "" ? NaN : data * 1;
};

export const isGtZeroInteger = (data: number) => {
  return !!(Number.isSafeInteger(data) && data > 0);
};

export const checkIsDataId = (data: number) => {
  if (!isGtZeroInteger(data)) {
    throw new Error("ID_INVALID");
  }
};
